package com.vtquang.mymaps;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcel;

public class MyLocation{ 
	private String _name;
	private String _vicinity;
	private double _distance;
	private String _lat;
	private String _lng;
	private Drawable _icon; 
	private String _strIcon;
	
	public MyLocation(){
		
	}
	
	public MyLocation(MyLocation loc){
		this.set_name(loc.get_name());
		this.set_vicinity(loc.get_vicinity());
		this.set_lng(loc.get_lng());
		this.set_lat(loc.get_lat());  
		this._strIcon = loc.get_strIcon();
		this._icon = loc.get_icon();
	}
	
	public String get_name() {
		return _name;
	}

	public void set_name(String _name) {
		this._name = _name;
	}

	public String get_vicinity() {
		return _vicinity;
	}

	public void set_vicinity(String _vicinity) {
		this._vicinity = _vicinity;
	}

	public String get_lat() {
		return _lat;
	}

	public void set_lat(String _lat) {
		this._lat = _lat;
	}

	public String get_lng() {
		return _lng;
	}

	public void set_lng(String _lng) {
		this._lng = _lng;
	}

	public Drawable get_icon() {
		return _icon;
	} 

	public double get_distance() {
		return _distance;
	}

	public void set_distance(double _distance) {
		this._distance = _distance;
	}

	public String get_strIcon() {
		return _strIcon;
	}

	 public void set_strIcon(String strIcon) { 
		this._strIcon = strIcon;
		InputStream is;
		try {
			is = (InputStream) new URL(_strIcon).getContent();
			_icon = Drawable.createFromStream(is, "src name");
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			_icon = null;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			_icon = null;
		}
	} 
}
